<!DOCTYPE html>
<html lang="en">
<head>
	{{template "pc/public/mycss.html" .}}
</head>
<style type="text/css">
	#wrapper{
		background: #f5f5f5!important;
	}
	.header-center{
		background: #fff;
	}
	.user_left{
		background: #fff;
	}
	.fenlei{
		width: 20%;
	}
	
	@media (max-width: 992px){
		.fenlei{
		    width: 100%;
		}
	}
</style>
<body class="common-home res layout-home1">
<div id="wrapper" class="wrapper-full banners-effect-7">
	<!-- Header Container  -->
	{{template "pc/public/head.html" .}}
  	{{template "pc/public/mytop.html" .}}
	<div class="main-container container">
		<div class="row mb-50">
			<!--Left Part Start -->
			{{template "pc/public/myleft.html" .}}
			<!--Middle Part Start-->
			<div id="content" class="col-md-10 col-sm-8 right mt-15">
				<div class="mycollection">
					<div class="header">
						<ul>
							<li><a class="on" href="/my/collect">关注的商品</a></li>
							<li><a href="/my/focus">收藏的店铺</a></li>
							<li><a href="/my/foot">浏览历史</a></li>
						</ul>
						<div>
							<form action="/my/collect">
							<input type="text" name="keywords" placeholder="请输入商品名称">
							<button>搜索</button>
							</form>
						</div>
					</div>
					<div class="box">
						<!-- <ul class="collection_list">
							<li class="on">全部商品 (1)</li>
							<li>商品分类 (1)</li>
							<li>商品分类 (1)</li>
							<li>商品分类 (1)</li>
							<li>商品分类 (1)</li>
						</ul> -->
						<!-- <div class="operation">
							<span class="fl"><input id="asd" type="checkbox" name=""></span>
							<b>全选</b>
							<a class="fr" href="javascript:void(0);"><i class="fa fa-shopping-cart"></i><em>取消收藏</em></a>
							<a class="fr" href="javascript:void(0);"><i class="fa fa-shopping-cart"></i><em>加入购物车</em></a>
						</div> -->
						<div class="goodslist">
							<ul>
								{{range .info}}
								<li id="{{.id}}">
									<a href="/product/content?id={{.pid}}">
										<img src="{{.pathname}}">
										<div>
											<p class="overpl1">{{.title}}</p>
											<p>￥ {{if .vprice0}}{{.vprice}}{{else}}{{.price}}{{end}}</p>
										</div>
									</a>
									<div class="p-stats">
										<a href="javascript:void(0);" class="addshopcar" data-id='{{.pid}}' data-minbuy='{{.minbuy}}'>
											<i class="fa fa-shopping-cart"></i>
											<em>加入购物车</em>
										</a>
										<a href="javascript:void(0);" class="del">
											取消收藏
										</a>
									</div>
								</li>
								{{end}}
							</ul>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>

<!-- Footer Container -->
{{template "pc/public/foot.html" .}}
{{template "pc/public/myfoot.html" .}}

</body>
</html>
<script type="text/javascript">
	$('.addshopcar').click(function(){
		var pid=$(this).attr('data-id')
		var minbuy=$(this).attr('data-minbuy')
	      $.ajax({
	        url:'/isShopcar',
	        type:"get",
	        data:{pid:pid},
	        success:function(res){
	          if (minbuy>1 && !res.isshopcar) {
	            wxc.xcConfirm("该产品的最小购买数为"+minbuy,"confirm",{onOk:function(){
	              $.ajax({
	                url:'/shopcar',
	                type:'post',
	                data:{num:1,pid:pid,minbuy:minbuy},
	                success:function(res){
	                  if(res==0){
	                    showToast('网络繁忙,请重试');
	                  }else if(res==1){
	                    showToast('加入购物车成功');
	                  }else if(res==2||res==962){
	                    wxc.xcConfirm("您还没有登入,请先登入","confirm",{onOk:function(){
	                      window.location.href="/login"
	                    }})
	                  }else if(res==3){
	                    showToast('库存不足');
	                  }
	                }
	              })
	            }})
	          } else {
	            $.ajax({
	              url:'/shopcar',
	              type:'post',
	              data:{num:1,pid:pid,minbuy:minbuy},
	              success:function(res){
	                if(res==0){
	                  showToast('网络繁忙,请重试');
	                }else if(res==1){
	                  showToast('加入购物车成功');
	                }else if(res==2||res==962){
	                  wxc.xcConfirm("您还没有登入,请先登入","confirm",{onOk:function(){
	                    window.location.href="/login"
	                  }})
	                }else if(res==3){
	                  showToast('库存不足');
	                }
	              }
	            })
	          }
	        }
	      })
	 })
	$('.del').click(function(){
	    var id=$(this).parent().parent().attr('id')
	    wxc.xcConfirm("您确定要取消收藏吗?","confirm",{onOk:function(){
	      $.ajax({
	        url:window.location.href,
	        data:{id:id,table:'mt_member_collection'},
	        type:'post',
	        success:function(res) {
	          if(res==1){
	            showToast('取消收藏成功');
	            $('#'+id).remove()
	          }else{
	            showToast('网络繁忙,请重试');
	          }
	        }
	      })  
	    }});
	  })
	var $typeheader = 'header-home1';

	$('.order ul li').click(function() {
		$(this).addClass('on');
		$(this).siblings('li').removeClass('on');
	});
</script>
<script type="text/javascript">
	// var chbAll=document.getElementById('asd');
 //        var chbs=document.querySelectorAll(
 //            "div span:first-child>input"
 //    );
 //    chbAll.onclick=function(){
 //        if (chbAll.checked) {
 //            chbAll.parentNode.style.backgroundImage = 'url(../../img/pc/imgs/checked2.png)';
 //        }else {
 //            chbAll.parentNode.style.backgroundImage = 'url(../../img/pc/imgs/checked1.png)';
 //        }
 //        for(var i=0;i<chbs.length;i++){
 //            chbs[i].checked=this.checked;
 //           if (chbs[i].checked) {
 //            chbs[i].parentNode.style.backgroundImage = 'url(../../img/pc/imgs/checked2.png)';
 //           }else {
 //            chbs[i].parentNode.style.backgroundImage = 'url(../../img/pc/imgs/checked1.png)';
 //           }
 //        }
 //    } 
 //     function selected(e) {
 //        var inselected =e.parentNode;
 //        if (e.checked) {
 //            inselected.style.backgroundImage = 'url(../../img/pc/imgs/checked2.png)';
 //        }else{
 //            inselected.style.backgroundImage = 'url(../../img/pc/imgs/checked1.png)';
 //            chbAll.checked=false;
 //        }
 //    }

 //    $('.collection_list li').click(function() {
 //    	$(this).addClass('on');
 //    	$(this).siblings('li').removeClass('on');
 //    });
</script>